package org.wuhong.config;

import com.wuhong.result.ResultData;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName ExceptionHandlerConfigBean
 * @Description TODO
 * @Author director吴
 * @Date 2022/2/20 12:34
 * @Version 1.0
 **/
@ControllerAdvice
public class ExceptionHandlerConfigBean {

        @ExceptionHandler(Exception.class)
        @ResponseBody//为了返回数据
        public ResultData handleSizeLimitExceededException(Exception se){
            ResultData resultData = new ResultData();
            resultData.setStatus(500);
            resultData.setMsg("发生异常咯");
            resultData.setData(se);
            se.printStackTrace();
            return resultData;
        }


}
